<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var obj = [{name:{name:"li"}}]
        function deepClone(obj){
            let res;
            if(obj instanceof Array || typeof obj =="object"){
                res = (typeof obj =="object"?{}:[]);
                for (let key in obj){
                    res[key] = deepClone(obj[key]);
                }
                return res;
            }else if(typeof obj == "number"||typeof obj == "string" || typeof obj == "boolean" || typeof obj == null){
                return obj;
            }
        }
        p = deepClone(obj)
        console.log('p: ', p);
    </script>
</body>
</html>